<?php 

	$conn = oci_connect("hospital", "hospital", "//localhost/XE"); 
	$pull = oci_parse($conn, "select MEDICATION_ID from ADD_TO where MEDICATION_ID = $_POST[med_id]");
	
	$total = 0;
	oci_execute($pull);
	$total = oci_fetch_all($pull,$result);
	
	if( $total != 0){
		echo "This  ID  already have";
	}else{
		
		$add = oci_parse($conn, "INSERT INTO ADD_TO VALUES('$_POST[med_id]','$_POST[gen_id]')");
		oci_execute($add);
	}

 ?>
 
<html>
<head><meta http-equiv="refresh" content="1; URL=main.php"></head>
<BODY bgcolor = "#ffffff">
<font color="#ffffff" size="20">Redirecting ...</font>
</body>
</html>
